﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ctlClientEditorNew.ascx.cs" Inherits="Ctl_ctlClientEditorNew" %>
<%@ Register src="ctlContactFace.ascx" tagname="ctlContactFace" tagprefix="uc2" %>

    <%--метки для radiobox дерева- не трогать--%>
    <style type="text/css">
        .chTree_Status{}
        .chTree_Categoria{}
        .style1
        {
            width: 407px;
        }
        </style> 
<asp:HiddenField ID="hf_tvStatus" runat="server" />
<asp:HiddenField ID="hf_tvCategoria" runat="server" />
   
<%--Общая информация--%>
<div class="TblCaption" style ="width:100%; text-align :left ; height :25px" onclick ="CaptionToggle('body_CommonInfo','caption_CommonInfo');"  >    
<table style="width:100%;">
            <tr>
                <td id="caption_CommonInfo" class ="ArrowDown" >
                    <asp:UpdateProgress ID="UpdateProgress1" runat="server"  >
                    <ProgressTemplate>
                        <asp:Image ID="Image1" runat="server" 
                            ImageUrl="~/images/loadinfo.net.gif" />
                    </ProgressTemplate>
                </asp:UpdateProgress>
                </td>
                <td style="text-align :left " >
                    <asp:UpdatePanel ID="updStatus" runat="server" UpdateMode="Conditional">
                        <ContentTemplate>
                            <table style="width: 100%;">
                                <tr>
                                    <td style="width:25%;text-align :left">
                                        <asp:Label ID="LblClientName" runat="server" Font-Bold="true" 
                                            Text="<%# Client.Name %>"></asp:Label>
                                    </td>
                                    <td style="text-align :center  ">
                                        <asp:Label ID="lblClientStatus" runat="server" 
                                            CssClass="<%# GetStateVisible() %>" Font-Bold="True" Font-Size="XX-Small" 
                                            ForeColor="#FF5050" Text="Есть несохраненные данные"></asp:Label>
                                    </td>
                                </tr>
                            </table>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </td>
                <td style="text-align :right " >
                    &nbsp;</td>
            </tr>
            </table>
</div> 
<div id="body_CommonInfo" style ="width:100%" >
   <table style="width:100%;" cellpadding ="2" cellspacing ="0">        
            <tr >
            <td width="25%" >
                &nbsp;</td>
            <td style="width:25%" class ="grd_td_item_caption" >
                Наименование:
                <asp:RequiredFieldValidator ControlToValidate ="txtClientName" ID=RequiredFieldValidator1 runat="server" ErrorMessage="*"></asp:RequiredFieldValidator>
             </td>
            <td  class ="grd_td_item" >
                <asp:TextBox ID="txtClientName" runat="server" Text =<%# Client.Name %> CssClass="TextBox"></asp:TextBox>
                
            </td>
            </tr>            
            <tr>
            <td width="25%">
                &nbsp;</td>
            <td onclick ="$('#ctl00_cphHead_lblClientStatus').show();" style="width:25%" class ="grd_td_item_caption" >
                <asp:Label ID="Label3" runat="server" Text="Куратор:"></asp:Label>
                </td>
            <td  class ="grd_td_item" >
            <asp:UpdatePanel ID ="updCurator" UpdateMode = "Conditional"  runat ="server"  >
            <ContentTemplate >
                <table width="100%" cellpadding ="0" cellspacing ="0">
                <asp:ListView ID="lvCurator" runat="server" onitemcommand="ItemCommand" 
                        onitemupdating="ItemUpdating" onitemediting="ItemEditing" 
                        onitemdatabound="ItemDataBound">
                <LayoutTemplate>
                       <tr runat="server" id="itemPlaceholder" >
                       </tr>                            
                </LayoutTemplate>
                <ItemTemplate >
                <tr >
                    <td style ="vertical-align :top " >
                        <table width ="100%" >
                        <tr >
                            <td style ="vertical-align :top" rowspan="2">
                               <%# (GetCuratorAsText()==string.Empty?"Нет данных":GetCuratorAsText())%>                                
                            </td>
                              <td style ="text-align :right; vertical-align :top ;width :25px" >
                                    <asp:ImageButton CommandName ="Edit" ID="ImageButton1" runat="server" 
                                        ImageUrl="~/images/icon-edit.gif" />
                            
                            </td>
                        </tr>                       
                         </table>                        
                    </td>
                </tr>
                </ItemTemplate>
                <EditItemTemplate >
                <tr >
                    <td >                        
                         <table width ="100%" >
                        <tr >                            
                            <td style ="vertical-align :top" >                            
                                <asp:DropDownList ID=cmbEmpl class="TextBox"   runat="server">
                                </asp:DropDownList>
                            </td>                            
                              <td style ="text-align :right; vertical-align :top ;width :25px" >
                                    <asp:ImageButton CommandName ="Update" ID="btnUpdCurator" runat="server" 
                                        ImageUrl="~/images/icon-save.gif" />
                            
                            </td>
                        </tr>
                        
                         </table>                        
                    </td>
                </tr>
                
                </EditItemTemplate>
                </asp:ListView>
                </table>     
             </ContentTemplate>
            </asp:UpdatePanel>
            
            </td>
        </tr>
            <tr>
            <td width="25%">
                &nbsp;</td>
            <td style="width:25%" class ="grd_td_item_caption" >
                <asp:Label ID="Label1" runat="server" Text="Статус:"></asp:Label>
                </td>
            <td  class ="grd_td_item" >
             <asp:UpdatePanel ID ="UpdatePanel1" UpdateMode = "Conditional" runat ="server"  >
            <ContentTemplate >
                <table width="100%" cellpadding ="0" cellspacing ="0">
                <asp:ListView ID="lvStatus" runat="server" onitemcommand="ItemCommand" 
                        onitemupdating="ItemUpdating" onitemediting="ItemEditing" 
                        onitemdatabound="ItemDataBound">
                <LayoutTemplate>
                       <tr runat="server" id="itemPlaceholder" >
                       </tr>                            
                </LayoutTemplate>
                <ItemTemplate >
                <tr >
                    <td style ="vertical-align :top " >
                        <table width ="100%" >
                        <tr >
                            <td style ="vertical-align :top" rowspan="2">
                               <%# (GetStatusAsText()==string .Empty?"Нет данных":GetStatusAsText()) %>                                
                            </td>
                              <td style ="text-align :right; vertical-align :top ;width :25px" >
                                    <asp:ImageButton CommandName ="Edit" ID="ImageButton1" runat="server" 
                                        ImageUrl="~/images/icon-edit.gif" />
                            
                            </td>
                        </tr>                       
                         </table>                        
                    </td>
                </tr>
                </ItemTemplate>
                <EditItemTemplate >
                <tr >
                    <td >
                        <table width ="100%" >
                        <tr >
                            <td style ="vertical-align :top" rowspan="2">
                               <asp:TreeView ID="tvStatus" runat="server">                                    
                                </asp:TreeView>
                                
                            </td>
                              <td style ="text-align :right; vertical-align :top ;width :25px" >
                                    <asp:ImageButton CommandName ="Update" ID="ImageButton1" runat="server" 
                                        ImageUrl="~/images/icon-save.gif" />
                            
                            </td>
                        </tr>
                        <tr >
                            <td>
                            </td> 
                        </tr>
                         </table>
                    </td>
                </tr>
                
                </EditItemTemplate>
                </asp:ListView>
                </table>     
            </ContentTemplate> 
            </asp:UpdatePanel> 
            </td>
        </tr>
            <tr>
            <td width="25%">
                &nbsp;</td>
            <td style="width:25%;" class ="grd_td_item_caption"  >            
                <asp:Label ID="Label2" runat="server" Text="Категория:"></asp:Label>
                </td>
         
            <td  class ="grd_td_item" style ="vertical-align:top "   >
            <asp:UpdatePanel ID ="updCategoria" UpdateMode = "Conditional"  runat ="server"  >
            <ContentTemplate >
                <table width="100%" cellpadding ="-2" cellspacing ="0">
                <asp:ListView ID="lvCategoria" runat="server" onitemcommand="ItemCommand" 
                        onitemupdating="ItemUpdating" onitemediting="ItemEditing" 
                        onitemdatabound="ItemDataBound">
                <LayoutTemplate>
                       <tr runat="server" id="itemPlaceholder" >
                       </tr>                            
                </LayoutTemplate>
                <ItemTemplate >
                <tr >
                    <td style ="vertical-align :top " >
                        <table width ="100%" >
                        <tr >
                            <td style ="vertical-align :top" rowspan="2">
                               <%# (GetCategoriaAsText()==string .Empty ?"Нет данных":GetCategoriaAsText())%>                                
                            </td>
                              <td style ="text-align :right; vertical-align :top ;width :25px" >
                                    <asp:ImageButton CommandName ="Edit" ID="ImageButton1" runat="server" 
                                        ImageUrl="~/images/icon-edit.gif" />
                            
                            </td>
                        </tr>                       
                         </table>                        
                    </td>
                </tr>
                </ItemTemplate>
                <EditItemTemplate >
                <tr >
                    <td >
                        <table width ="100%" >
                        <tr >
                            <td style ="vertical-align :top" rowspan="2">
                               <asp:TreeView ID="tvCategoria" runat="server">
                                   
                                </asp:TreeView>
                                
                            </td>
                              <td style ="text-align :right; vertical-align :top ;width :25px" >
                                    <asp:ImageButton CommandName ="Update" ID="ImageButton1" runat="server" 
                                        ImageUrl="~/images/icon-save.gif" />
                            
                            </td>
                        </tr>
                        <tr >
                            <td>
                            </td> 
                        </tr>
                         </table>
                    </td>
                </tr>
                
                </EditItemTemplate>
                </asp:ListView>
                </table>            
            </ContentTemplate>
            </asp:UpdatePanel>    
            </td>
        </tr>
            <tr>
                         <td width="25%" style ="vertical-align :top ">
                </td>
                <td style="width:25%;vertical-align :top;border-bottom: 0px ;" class ="grd_td_item_caption"   >
                Дополнительно:</td>
                <td  >
                <asp:TextBox ID="txtDescribe" runat="server" Width="98%" Text =<%# Client.Describe %> CssClass="TextBox" Height="38px" 
                    TextMode="MultiLine"></asp:TextBox>
            </td> 
           
        </tr>
            <tr >
            <td width="25%" >
                &nbsp;</td>
            <td style="width:25%"  >
                </td>
                
            <td   style="text-align :right " >
            <asp:UpdatePanel ID=UpdatePanel11 runat ="server"  >
            <ContentTemplate >
                <asp:Button ID=Button1 runat ="server" CssClass ="btn_wizard" Text ="Сохранить"  OnClick ="btnSave_Click"  />
            </ContentTemplate> 
            </asp:UpdatePanel>
                </td>
            </tr>    
    </table>
</div> 

<%--контакты--%>
<div class="TblCaption" style ="width:100%; height :25px" onclick ="CaptionToggle('body_contact','caption_Contact');"  >    
<table style="width:100%;">
            <tr>
                <td id="caption_Contact" class ="ArrowDown" >
                    &nbsp;</td>
                <td >
                 Контакты
             &nbsp;</td>
                <td class ="style1" >
                    &nbsp;</td>
            </tr>
        </table>
</div>
<div id="body_contact" style ="width:100%" >
<table style="width:100%;" cellpadding ="2" cellspacing ="0">          
            <tr >
            <td width="25%" style ="vertical-align :top ">
                &nbsp;</td>
            <td style="width:25%;vertical-align :top" class="grd_td_item_caption">
                Телефоны:</td>
                <td class="grd_td_item"  >
                    <asp:TextBox ID="txtTelefon" runat="server" Text =<%# Client.Phones %>  CssClass="TextBox"></asp:TextBox>
                </td>
        </tr>       
            <tr >
            <td width="25%" style ="vertical-align :top ">
                &nbsp;</td>
            <td style="width:25%;vertical-align :top" class="grd_td_item_caption">
                EMail:</td>
                <td class="grd_td_item"  >
                    <asp:TextBox ID="txtMail" runat="server" Text =<%# Client.Email %>  CssClass="TextBox"></asp:TextBox>
                </td>
        </tr>       
            <tr >
            <td width="25%" style ="vertical-align :top ">
                &nbsp;</td>
            <td style="width:25%;vertical-align :top" class="grd_td_item_caption">
                Адрес:</td>
                <td class="grd_td_item"  >
                    <asp:TextBox ID="txtAdress" runat="server" Text =<%# Client.Adress %>  CssClass="TextBox"></asp:TextBox>
                </td>
        </tr>       
            <tr >
            <td width="25%" style ="vertical-align :top ">
                &nbsp;</td>
            <td style="width:25%;vertical-align :top" class="grd_td_item_caption">
                URL:</td>
                <td class="grd_td_item"  >
                    <asp:TextBox ID="txtUrl" runat="server" Text =<%# Client.URL %>  CssClass="TextBox"></asp:TextBox>
                </td>
        </tr>               
            <tr >
            <td width="25%" >
                &nbsp;</td>
            <td style="width:25%" >
                </td>
                
            <td   style="text-align :right " >
            <asp:UpdatePanel ID=UpdatePanel2 runat ="server"  >
            <ContentTemplate >
                <asp:Button ID=Button2 runat ="server" CssClass ="btn_wizard" Text ="Сохранить"  OnClick ="btnSave_Click"  />
            </ContentTemplate> 
            </asp:UpdatePanel>
                </td>
            </tr>            
          
            
            </table>
</div> 
   
<%--реквизиты--%>
<div class="TblCaption" style ="width:100%; height :25px" onclick ="CaptionToggle('body_Account','caption_Account');"  >    
<table style="width:100%;">
            <tr>
                <td id="caption_Account" class ="ArrowDown" >
                    &nbsp;</td>
                <td >
                 Реквизиты
             &nbsp;</td>
                <td class ="style1" >
                    &nbsp;</td>
            </tr>
        </table>
</div> 
<div id="body_Account" style ="width:100%" >
<table style="width:100%;" cellpadding ="2" cellspacing ="0">                              
            <tr>
            <td width="25%" style ="vertical-align :top ">
                &nbsp;</td>
            <td style="width:25%;vertical-align :top" class="grd_td_item_caption">
                ИНН:</td>
                <td class="grd_td_item"  >
                    <asp:TextBox ID="txtInn" runat="server" Text =<%# Client.INN %>  CssClass="TextBox" 
                        AutoCompleteType="Disabled"></asp:TextBox>
                </td>
        </tr>
            <tr>
            <td width="25%" style ="vertical-align :top ">
                &nbsp;</td>
            <td style="width:25%;vertical-align :top" class="grd_td_item_caption">
                КПП:</td>
                <td class="grd_td_item"  >
                    <asp:TextBox ID="txtKPP" runat="server" Text =<%# Client.KPP %>  CssClass="TextBox"></asp:TextBox>
                </td>
        </tr>       
            <tr>
            <td width="25%" style ="vertical-align :top ">
                &nbsp;</td>
            <td style="width:25%;vertical-align :top" class="grd_td_item_caption">
                Р/С</td>
                <td class="grd_td_item"  >
                    <asp:TextBox ID="txtAccount" Text =<%# Client.Account %>  runat="server" CssClass="TextBox" 
                        AutoCompleteType="Disabled"></asp:TextBox>
                </td>
        </tr>                   
            <tr >
            <td width="25%" >
                &nbsp;</td>
            <td style="width:25%"  >
                </td>
                
            <td   style="text-align :right " >
            <asp:UpdatePanel ID=UpdatePanel3 runat ="server"  >
            <ContentTemplate >
                <asp:Button ID=Button3 runat ="server" CssClass ="btn_wizard" Text ="Сохранить"  OnClick ="btnSave_Click"  />
            </ContentTemplate> 
            </asp:UpdatePanel>
                </td>
            </tr>
   </table>
</div>

<asp:Panel ID=Panel1 Width="100%" Visible =<%# !IsNewRecord %> runat="server">
<%--Контактные лица--%>
<asp:UpdatePanel ID=UpdatePanel4 runat="server" UpdateMode ="Conditional"   >
<ContentTemplate >

<div class="TblCaption" style ="width:100%; height :25px"  >    
<table style="width:100%;">
            <tr>
                <td id="caption_ContactFaces" class ="ArrowDown" onclick ="CaptionToggle('body_ContactFaces','caption_ContactFaces');" >
                    &nbsp;</td>
                <td onclick ="CaptionToggle('body_ContactFaces','caption_ContactFaces');" >
                 Контактные лица
             &nbsp;</td>
             <td onclick ="CaptionToggle('body_ContactFaces','caption_ContactFaces');" >
             &nbsp;
             </td>
                <td style="text-align :right; width :300px" >
                    <asp:Button ID="btnAddContactFace" runat="server" CssClass="btn" 
                        onclick="btnAddContactFace_Click" Text="Добавить" />
                </td>
            </tr>
        </table>
</div> 

<div id="body_ContactFaces" style ="width:100%" >
<table cellpadding ="0" cellspacing ="0" width ="100%" >
                 <asp:ListView ID="lvContactFaces" runat="server" onitemcommand="ItemCommand" 
                        onitemediting="ItemEditing" onitemupdating="ItemUpdating" 
                        onitemdatabound="lvContactFaces_ItemDataBound">                 
                 <LayoutTemplate >                    
                    <tr runat="server" id="itemPlaceholder" ></tr>                                                
                 </LayoutTemplate>                 
                 <ItemTemplate >
                    <tr id=Tr1  runat ="server"   style ="height:15px" >
                    <td class ="grd_td_item">                  
                          <table width ="100%" cellpadding ="2px" cellspacing ="0">            
                            <tr >
                            <td   style ="width :15px" >                                                    
                                <asp:ImageButton ID=btnEditWorker CommandName ="Edit" ImageUrl ="~/images/grd_plus.gif" runat="server" />
                            </td>                      
                            <td  style ="width :30%" >                
                                <%# (string)Eval ("FullName") %>
                            </td>
                            <td style ="width :20%"  >                    
                                <%# (string)Eval ("Position") %>
                            </td>                        
                            <td  >
                             <%# (string)Eval("ContactsAsString")%>                                
                            </td>            
                            <td style="width:30px; text-align :right"   >
                                <asp:ImageButton ID=btnWorkerRemove OnClientClick ="OnDeleteClick();" ImageUrl ="~/images/trash.png" CommandArgument =<%# (string) Eval("ID") %> OnClick ="BntRemoveWorker_Click" runat="server" />
                            </td>            
                            </tr> 
                          </table>                                              
                    </td>
                    </tr>
                 </ItemTemplate>    
                 <EditItemTemplate >
                    <tr id=Tr1  runat ="server"   style ="height:15px" >
                    <td class ="grd_td_item"> 
                     <uc2:ctlContactFace ID="ctlContactFace1"    FaceID='<%# (string)Eval("ID") %>'  runat="server" />
                    </td> 
                    </tr> 
                 </EditItemTemplate >
                 <EmptyDataTemplate >
                 <tr>
                 <td style ="text-align :center ">
                    Контактных лиц нет                    
                 </td> 
                 </tr>
                 </EmptyDataTemplate>
                </asp:ListView>
            </table>

</div> 


</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel> 